//
//  SubMenu.h
//  CMOLTest
//
//  Created by mac on 16/3/10.
//  Copyright © 2016年 mac. All rights reserved.
//

#import <UIKit/UIKit.h>
typedef enum{
    DirectionLeftType,
    DirectionRightType,
    DirectionCenterType,
}DirectionType;
@protocol SubMenuDataSource<NSObject>
-(NSInteger)numberOfRowsInSubMenu;
-(NSString *)titileForSubMenuInRow:(NSInteger)row;
@end

@protocol SubMenuDelegate<NSObject>
-(void)SubMenuControllerDidClickIndex:(NSInteger)index;
@end
@interface SubMenu : UIView

@property(nonatomic,strong)UIViewController *controller;
@property(nonatomic,strong)UIView *content;
@property(nonatomic,weak)UIView  *bgView;

@property(nonatomic,weak)id<SubMenuDelegate> delegate;
@property(nonatomic,weak)id<SubMenuDataSource> datasource;
//判断左侧还是下册的下拉菜单
-(instancetype)initWithDirection:(DirectionType)directiontype;
-(void)showFrom:(UIView *)from;
-(void)showDownFromOrder:(UIView *)from withx:(CGFloat )x;
-(void)showDownFrom:(UIView *)from withx:(CGFloat )x;
-(void)showDownFrom:(UIView *)from withx:(CGFloat )x andWith:(CGFloat)width;
- (void)dismiss;
@end
